//
//  THApplyResultViewController.m
//  TreeHole
//
//  Created by apple on 2020/9/21.
//  Copyright © 2020 stoneobs. All rights reserved.
//

#import "THApplyResultViewController.h"
#import "THApplyToBeBabyTeacherViewController.h"
@interface THApplyResultViewController ()

@end

@implementation THApplyResultViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我是育婴师";
    [self stoneobs_ui_configSubView];
    // Do any additional setup after loading the view.
}
#pragma mark --configSubView
- (void)stoneobs_ui_configSubView{
    UIView * header = [[UIView alloc] initWithFrame:STONEOBS_UI_UISCREEN_FRAME];
    
    UIImageView * stoneobs_ui_imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 32, 142, 142)];
    stoneobs_ui_imageView.image = ST_IMAGE_NAMED(@"支付成功");
    stoneobs_ui_imageView.centerX = UISCREEN_WIDTH / 2;
    [header addSubview:stoneobs_ui_imageView];
    
    
    STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(0,stoneobs_ui_imageView.bottom+10, UISCREEN_WIDTH, 20)
                                                            text:@"stoneobs_ui_imageView"
                                                       textColor:STONEOBS_UI_FIRST_TEXT_COLOR
                                                            font:16
                                                     isSizetoFit:NO
                                                   textAlignment:NSTextAlignmentCenter];
    [header addSubview:stoneobs_ui_label];
    if (self.apply_model.status.intValue == 0) {
        stoneobs_ui_label.text = [NSString stringWithFormat:@"申请已被驳回,%@",self.apply_model.remark];
        stoneobs_ui_imageView.image = ST_IMAGE_NAMED(@"支付失败");
    }
    if (self.apply_model.status.intValue == 2) {
        stoneobs_ui_label.text = [NSString stringWithFormat:@"申请已提交，审核中..."];
    }
    
    CGFloat top = stoneobs_ui_label.bottom + 30;
    __weak typeof(self) weakSelf =  self;
    ({
        STButton * stoneobs_ui_button = [[STButton alloc] initWithFrame:CGRectMake(15, top, UISCREEN_WIDTH-30, 40)
                                                                  title:@"返回"
                                                             titleColor:STONEOBS_UI_THEME_BACKGROUNDCOLOR
                                                              titleFont:15
                                                           cornerRadius:0
                                                        backgroundColor:nil
                                                        backgroundImage:nil
                                                                  image:nil];
        stoneobs_ui_button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        [stoneobs_ui_button stbw_setBorderWith:1 borderColor:STONEOBS_UI_THEME_BACKGROUNDCOLOR cornerRadius:4];
        [stoneobs_ui_button setClicAction:^(UIButton *sender) {
            [weakSelf.navigationController popViewControllerAnimated:YES];
        }];
        stoneobs_ui_button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        top = stoneobs_ui_button.bottom + 15;
        [header addSubview:stoneobs_ui_button];
    });
    if (self.apply_model.status.intValue == 0) {
        STButton * stoneobs_ui_button = [[STButton alloc] initWithFrame:CGRectMake(15, top, UISCREEN_WIDTH-30, 40)
                                                                  title:@"重新申请"
                                                             titleColor:WH_UICOLOR_FROM_RGBA(0xFF8B59)
                                                              titleFont:15
                                                           cornerRadius:0
                                                        backgroundColor:nil
                                                        backgroundImage:nil
                                                                  image:nil];
        stoneobs_ui_button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        [stoneobs_ui_button stbw_setBorderWith:1 borderColor:WH_UICOLOR_FROM_RGBA(0xFF8B59) cornerRadius:4];
        [stoneobs_ui_button setClicAction:^(UIButton *sender) {
            THApplyToBeBabyTeacherViewController * vc = THApplyToBeBabyTeacherViewController.new;
            vc.apply_model = weakSelf.apply_model;
            [weakSelf pushViewController:vc animated:1];
        }];
        stoneobs_ui_button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        top = stoneobs_ui_button.bottom + 15;
        [header addSubview:stoneobs_ui_button];
    }

    header.height = top;
    self.tableView.tableHeaderView = header;
    self.tableView.backgroundColor = UIColor.whiteColor;
}

@end
